package com.api.volunteer.util;

import com.api.volunteer.model.UserEntity;
import org.springframework.stereotype.Component;

/**
 * @author 邹宇杰
 * @email 2901570623@qq.com
 * @date 2022/3/30 15:50
 */
@Component
public class Holder {

    private ThreadLocal<UserEntity> local = new ThreadLocal<>();

    public void setUser(UserEntity userEntity){
        local.set(userEntity);
    }

    public UserEntity getUser(){
        return local.get();
    }

    public void removeUser(){
        local.remove();
    }
}
